/** @jsxImportSource @emotion/react */
import * as React from "react";
import {  OriginalViewProps,  } from "../../common/base";
import {config设备概况, EntranceSetup, ProjectListGen,} from "./orcBase";
import { createItem,  } from "../../common/eHelper";
import {useRecordListSubr} from "../../hook/useRecordListSub";
import {ConclusionVsWDj, DeviceSurveyPrf, VsProjects默认} from "./editor";
import {config资料审查, MaterialReview, PreviousQuestion} from "./editReview";
import {Macroscopic,} from "./editMacr";
import {SafetyAccesor, config安全附件,} from "./editSAcces";
import {ProjectListRq} from "../editProj";
import {BlobInputList, InputLine} from "customize-easy-ui-component";
import {AdditionalTest, Corrosive} from "../../movable/RqThorough/editAddon";

// const defvcbFunc = (par: any) => {
//   return  par;
// };
const inputCB = (obj: any, setObj: React.Dispatch<React.SetStateAction<any>>) => {
  return  <>
    <InputLine label={`检验结果`}>
      <BlobInputList value={obj?.res ||''} rows={1}  datalist={[ ]}
                     onListChange={v => setObj({...obj, res: v || undefined}) } />
    </InputLine>
    <InputLine label={`说明`}>
      <BlobInputList value={obj?.memo ||''} rows={1}
                     onListChange={v => setObj({...obj, memo: v || undefined}) } />
    </InputLine>
  </>;
};
export const configSetter=(verId:string,orc?:any)=>{
  return  config资料审查(orc);
};
//独立的分项报告的编辑器不在此列出的：
const recordPrintList =[
  createItem('Entrance', <EntranceSetup/>),
  createItem('ProjectList', <ProjectListRq config={VsProjects默认} inpCB={inputCB} label={'目录页'}/>),
  createItem('ProjectListGen', <ProjectListGen label={'有压力容器定期检验报告附页吗'}/>),
  createItem('Survey', <DeviceSurveyPrf config={config设备概况} label={'检验结论报告-设备概况'}/>),
  createItem('Conclusion', <ConclusionVsWDj label={'检查结论报告-下结论'}/>),

  createItem('MaterialReview', <MaterialReview  config={configSetter}  label={'压力容器资料审查报告-技术参数'}/>),
  createItem('PreviousQuestion', <PreviousQuestion label={'压力容器资料审查报告-结果和上次问题'}/>),
  //createItem('MaterialReview', <ThreeConfigRaft config={configSetter} label={'资料审查-(上)'} defValCb={defvcbFunc} adField={['盛装介质']}>
  createItem('Macroscopic', <Macroscopic label={'压力容器宏观检验报告'}/>),
  createItem('SafetyAccesor', <SafetyAccesor config={config安全附件} label={'安全附件检验报告'}/>),

  createItem('AdditionalTest', <AdditionalTest label={'附加检验报告(上)'}/>),
  createItem('Corrosive', <Corrosive label={'附加检验报告(下)'} jyjg={'检测结果'}/>),
  createItem('_Controller',  <></>),
];

export const OriginalView=
  React.forwardRef((
    { action: modAction,  verId, repId='', rep}
    :OriginalViewProps, ref
  ) => {
    const {list}=useRecordListSubr(ref,rep,recordPrintList,modAction,verId);
    return <React.Fragment>
      {list}
    </React.Fragment>;
  } );
